package com.aaa.service.sas.impl;

import com.aaa.dao.sas.TSasPlanMapper;
import com.aaa.entity.MyPage;
import com.aaa.entity.sas.TSasPlane;
import com.aaa.service.sas.TSasPlanService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TSasPlanServiceImpl implements TSasPlanService {
    @Autowired
    private TSasPlanMapper tSasPlanMapper;
    @Override
    public PageInfo queryAll(MyPage myPage) {
        PageHelper.startPage(myPage.getPage(),myPage.getLimit());
        return new PageInfo(tSasPlanMapper.selectAllData());
    }

    @Override
    public boolean selectPlan(TSasPlane plane) {
        List<TSasPlane> select=tSasPlanMapper.select(plane);
        return select.size()==0;
    }

    @Override
    public boolean insertPlane(TSasPlane plane) {
        return tSasPlanMapper.insert(plane)>0;
    }

    @Override
    public TSasPlane queryByQyCode(TSasPlane tSasPlane) {
        TSasPlane tSasPlane1=tSasPlanMapper.selectOne(tSasPlane);
        return tSasPlane1;
    }

    @Override
    public boolean updatePlan(TSasPlane plane) {
        return tSasPlanMapper.updateByPrimaryKeySelective(plane)>0;
    }
//删除二维码
    @Override
    public boolean del(TSasPlane tSasPlane) {
        int delete=tSasPlanMapper.delete(tSasPlane);

        return delete>0?true:false;
    }
}
